<!doctype html>
<html>
{include file="head.html"}

<body>
<style>
.goCat{cursor:pointer;}
</style>
<script>
var qsjia={$shop.send_startprice};
</script>
<div class="fullscreen">
   
    <div class="topfixed">
      <div class="t_left"><a href="/index.php" class="goBack"><i class="back"></i></a></div>
      <div class="t_main">{$shop.shopname}</div>
      <div class="t_right">
      
      <a href="javascript:;" style="
    display: inline-block;
    margin-right: 10px;
    top: -5px;
    position: relative;
" class="{if $shop.isfav}fav_shop_cancel{else}fav_shop_add{/if}" v="{$shop.shopid}"><i class="ico"></i></a>
	
    <div class="ico_search" id="cl-search"></div>
</div>
      
    </div>
    
    <div class="search-box" id="search-box">
    	<div class="l">
        	<div class="mn">
        	<input type="text" name="keyword" id="keyword" placeholder="请输入商品名称">
            </div>
        </div>
        <div class="r"><button class="btn" type="button" id="search-submit">搜索</button></div>
    </div>
    
    <script>
    
	
	$(document).on("click","#cl-search",function(){
		$("#search-box").toggle();
		 
	});
	 
	$(document).on("click","#search-submit",function(){
		window.location='/index.php?m=shop&shopid={$shop.shopid}&keyword='+$("#keyword").val();
	});
    </script>
    
    <div class="paddingheight" style="height:80px;"></div>
    <div class="tabs" style="position:fixed; left:0px; right:0px; z-index:5; background-color:#eee; top:45px">
					<a href="/index.php?m=shop&shopid={$shop.shopid}" class="item active">商品</a>
					<a href="/index.php?m=shop&a=comment&shopid={$shop.shopid}" class="item">评价</a>
					<a href="/index.php?m=shop&a=detail&shopid={$shop.shopid}" class="item">商家</a>
				</div>
    <div class="market_wrap">  
     
      <div class="leftbox" style="top: 80px;">
        <ul class="comsort">
          <li  class="goCat {if get('shop_cid') eq 0}cur{/if}" v="0"><a >推荐</a></li>	
          {foreach item=c from=$catlist}
          <li  class="goCat {if get('shop_cid') eq $c.id}cur{/if}" v="{$c.id}"><a>{$c.title}</a></li>
          {/foreach}
        </ul>
      </div>
      
      <div class="rightbox" style="top: 33px; position:inherit;">
        <div class="flexslider">
         {get data=ad1 model=shop_flash fun=get("$shop.shopid",4)}
          <ul class="slides clearfix">
          {foreach item=c from=$ad1}
            <li><a href="{$c.link1}"><img class="img" src="{$c.imgurl|images_site}" width="100%"></a> </li>
          {/foreach}  
           
          </ul>
        </div>
         
        <div class="product_sendbox clearfix">
      <div class="fl">{$shop.send_time}分钟<br>
        送货到寝 </div>
      <div class="fr">{$shop.send_startprice}元<br>起送</div>
      <div class="time">营业时间<b class="red">{$shop.yystart}-{$shop.yyend}</b></div>
    </div>
    {include file="inc/shop_gonggao.html"}
        
        <div class="market_tabs_wrap clearfix">
          <div class="market_tabs clearfix fl">
            <div class="first_item"> <a href="javascript:;" class="orderby " v="default" >默认</a> </div>
            <ul class="last_item">
              <li class="b3"><a href="javascript:;" class="orderby" v="price" ind="asc">价格</a></li>
              <li class="b2"><i class="ico top asc "></i><br>
                <i class="ico bot desc "></i></li>
              <li class="b1"><a href="javascript:;" class="orderby" v="buy_num" ind="desc">销售</a></li>
            </ul>
          </div>
        </div>
        
        <ul class="market_list clearfix" id="pro-list">
          {foreach item=c from=$prolist}
          <li class="clearfix">
            <div class="fl"><a href="/index.php?m=shop_product&a=show&id={$c.id}&shopid={$c.shopid}"><img src="{$c.imgurl|images_site}.small.jpg" class="img"></a></div>
            <div class="fr">
              <p class="tit">{$c.title}</p>
              <p class="tags"><i class="global_icon red">保</i></p>
              <div class="num"><span class="f_left"><del>￥{$c.market_price}</del></span><span class="f_right">已售{$c.buy_num}份</span></div>
              <div class="pricebox">
                <p class="price">￥<b class="red">{if $c.lower_price>0}{$c.lower_price}{else}{$c.price}{/if}</b></p>
                <div class="showcart"> {if $c.total_num eq 0}已售罄{else}
                  <div class="cart_icon {if $cart[product][$c[id]]}none{/if}"></div>
                  <div class="cart_num" {if $cart[product][$c[id]]} style="display:block;"{/if} object_id="{$c.id}" shopid="{$c.shopid}" productid="{$c.productid}"> 
                    <a class="Decrease" href="javascript:void(0)"><i>-</i></a>
                    <input class="Amount" value="{$cart[product][$c[id]][amount]|intval}" autocomplete="off" maxlength="3">
                    <a class="Increase" href="javascript:void(0)"><i>+</i></a>  
                  </div>{/if}
                </div>
              </div>
             
            </div>
          </li>
          {foreachelse}
          <li class="clearfix"><div style="padding:10px;">暂无数据</div></li>
          {/foreach}
        </ul>
        {if !ISWAP}
        {$pagelist}
        {/if}
        <div id="loadmore" class="pullup">加载更多</div>
        <div class="clearfix"></div>
        
        {include file="footer.html"} </div>
    </div>
  </div>
 
<script type="text/html" id="pro-list-tpl">
<%for(var i=0;i<prolist.length;i++){%>
								<li class="clearfix">
									<div class="fl"><a href="/index.php?m=shop_product&a=show&id=<%=prolist[i].id%>&shopid=<%=prolist[i].shopid%>"><img src="<%=images_site(prolist[i].imgurl)%>.100x100.jpg" class="img"></a></div>
									<div class="fr">
										<p class="tit">
											<%=prolist[i].title%>
										</p>
										<p class="tags"><i class="global_icon red">保</i></p>
										<div class="num"><span class="f_left"><del>￥0.0</del></span><span class="f_right">已售<%=prolist[i].buy_num%>份</span></div>
										<div class="pricebox">
											<p class="price">￥<b class="red"><%=prolist[i].price%></b></p>
											<div class="showcart">
												<div class="cart_icon <%if(prolist[i].incart==1){%>none<%}%>"></div>
												<div class="cart_num" <%if(prolist[i].incart==1){%> style="display:block;"
													<%}%> object_id="<%=prolist[i].id%>" shopid="<%=prolist[i].shopid%>" productid="">
																<a class="Decrease" href="javascript:void(0)"><i>-</i></a>
																<input class="Amount" value="<%if(prolist[i].incart==1){%><%=prolist[i]['cart'].amount%><%}else{%>0<%}%>" autocomplete="off" maxlength="3">
																<a class="Increase" href="javascript:void(0)"><i>+</i></a>
												</div>
											</div>
										</div>

									</div>
								</li>

								<%}%>

</script> 
<script src="{$skins}js/jquery.flexslider-min.js"></script>
 <script src="/plugin/jquery/template-native.js"></script>
 <script src="/plugin/skyweb/listload.js"></script>
<script>
 var orderby='price',ind="desc";
 var shopid="{$shop.shopid}";
 var per_page={$per_page};
 var shop_cid="{$smarty.get.shop_cid|intval}";
 var first=false;
 function prolist(){
	 if(per_page==0 && !first){
		 
		return false; 
	 }
	get(SITE+"/index.php?m=shop&shopid="+shopid+"&shop_cid="+shop_cid+"&orderby="+orderby+"&index="+ind+"&per_page="+per_page,function(data){
		per_page=data.data.per_page;
		if(per_page==0){
			//skyToast('没有数据了');
			$("#loadmore").hide();
		}else{
			$("#loadmore").show();
		}
		var html=template("pro-list-tpl",data.data);
		if(first){
			$("#pro-list").html(html);
			first=false;
		}else{
			$("#pro-list").append(html);
		}
		 
	})
 }
 $(document).on("click",".goCat",function(){
	shop_cid=$(this).attr("v");
	$(".goCat").removeClass("cur");
	$(this).addClass("cur");
	per_page=0;
	first=true; 
	prolist();
 });
 
  $(document).on("click",".orderby",function(){
	orderby=$(this).attr("v");
	ind=$(this).attr("ind");
	if(ind=='asc'){
		$(".asc").addClass("cur");
		$(".desc").removeClass("cur");
	}else if(ind=='desc'){
		$(".desc").addClass("cur");
		$(".asc").removeClass("cur");
	}else if(orderby=='default'){
		$(".asc").removeClass("cur");
		$(".desc").removeClass("cur");
	}
	$(".orderby").removeClass("cur");
	$(this).addClass("cur");
	per_page=0;
	first=true; 
	prolist();
 });
 
 listload.loadid="#loadmore";
 listload.showload(function(){
		prolist();
 });
 
 $(".flexslider").flexslider();
 $(document).on("click",".showcart .cart_icon",function(e) {
    $(this).fadeOut(10).next(".cart_num").fadeIn("fast");
	$(this).parents(".showcart").find(".Increase").trigger("click");
});
 imgResize(240,480);
 $(window).resize(function(){
	 imgResize(240,240);
 })
 
</script>
<script src="{$skins}js/shop_cart.js"></script> 
 
 {assign var="botnav" value="shop"} 
<script src="/index.php?m=stat_view_day&a=add&shopid={$shop.shopid}&k=shop"></script> 
{include file="botnav.html"}
</body>
</html>
